package main

import (
	"fmt"
	"strings"
)

func main() {
	var name string = "bobby:\"慕课网\""
	//var name2 string = `\\\\\\\n`
	fmt.Println(name)
	//fmt.Println(len(name))
	//fmt.Println(len([]rune(name)))
	fmt.Println(strings.Contains(name, "慕课网"))
	fmt.Println(strings.Index(name, "慕课网"))
	fmt.Println(strings.Count(name, "b"))
	fmt.Println(strings.HasPrefix(name, "b"))
	fmt.Println(strings.HasSuffix(name, "\""))

	fmt.Println(strings.ToUpper("boobY"))
	fmt.Println(strings.ToLower("BOBBy"))
	//逐个比较ascii码  超出不比较
	fmt.Println(strings.Compare("ab", "bc"))
	//去掉空格
	fmt.Println(strings.TrimSpace(" bobby "))
	//左去掉字符串
	fmt.Println(strings.TrimLeft("bobby", "b"))
	//左右去掉字符串
	fmt.Println(strings.Trim("b  o bby b", "b"))

	fmt.Println(strings.Split("bobby imooc", " "))
	//join连接数组
	arrs := strings.Split("bobby imooc", " ")
	fmt.Println(strings.Join(arrs, "-"))

	fmt.Println(strings.Replace("bobby: 18 18", "18", "19", 1))

}
